import {
	defineConfig,
	loadEnv
} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';






export default ({
	mode
}) => {
	return defineConfig({
		// base: "/",
		build: {
			outDir: 'dist', // 确保输出目录正确
			assetsDir: 'assets', // 你可以根据需要调整资源目录
			rollupOptions: {
				input: {
					main: 'index.html', // 确保入口文件正确
				},
				output: {
					entryFileNames: 'assets/[name].js',
					chunkFileNames: 'assets/[name].js',
					assetFileNames: 'assets/[name].[ext]',
				},
			},
		},
		envPrefix: ['VITE_'],
		plugins: [
			vue()
		],
		optimizeDeps: {
			include: ['Index'], // 包含这些模块

		},
		resolve: {
			alias: {
				'@': path.resolve(__dirname, 'src'),
			},
		},
		// base: loadEnv(mode, process.cwd()).VITE_APP_BASE_API
	})
}